import request from "@/utils/request.ts";

/**
 * 获取路由列表
 * @param data
 */
export const getRouterList = (data: any) => {
  return request({
    url: '/moyu/router/list',
    method: 'get',
    data
  })
}

/**
 * 获取路由树
 * @param data
 */
export const getRouterTree = (data: any) => {
  return request({
    url: '/moyu/router/tree',
    method: 'get',
    data
  })
}

export const getRouterById = (routerId: string) => {
  return request({
    url: '/moyu/router/' + routerId,
    method: 'get'
  })
}

export const saveRouter = (data: any) => {
  return request({
    url: '/moyu/router',
    method: 'post',
    data
  })
}

/**
 * 删除路由
 * @param routerId 路由id
 */
export const deleteRouter = (routerId: string) => {
  return request({
    url: `/moyu/router/${routerId}`,
    method: 'DELETE'
  })
}
